<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/bootstrap3/bootstrap.autocomplete.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
<script src="/res/third/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/res/third/easyUI/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script type="text/javascript">
	function sosuo() {
		var lpath = location.pathname;
		$("#soform").attr("action", lpath + "?pageNo=" + 1);
		$("#soform").submit();
	}
</script>
<style type="text/css">
</style>

</head>

<body>
	<div class="panel panel-info panel-content">
		<div class="panel-heading">
			<button style="float: right" type="button" onclick="add()" class="btn btn-info">
				<span class="glyphicon glyphicon-plus"></span>
				&nbsp;新增签约用户
			</button>

			<form id="soform" method="post">
				<table>
					<tr>
						<td class="w80" style="padding-top: 5px">
							<label for="identity" class="center-block">身份：</label>
						</td>
						<td class="w200 ">
							<select class="form-control" name="so_identity">
								<option value="">全部</option>
								[#list identitys as ident]
									<option value="${ident.code!}" [#if so_identity??][#if ident.code==so_identity]selected[/#if][/#if]>${ident.name!}</option>
								[/#list]
							</select>
						</td>
						<td style="padding-left: 10px">
							<div class="input-group">
								<span class="input-group-btn">
									<button class="btn btn-default" type="button" onclick="sosuo()">搜索</button>
								</span>
							</div>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<table class="table table-hover table-bordered table-striped table-condensed">
			<thead>
				<tr>
					<th>序号</th>
					<th>公司名称</th>
					<th>签约金额</th>
					<th>目标完成量</th>
					<th>身份</th>
					<th>签约时间</th>
					<th>到期时间</th>
					<th>操作</th>
				</tr>
			</thead>
			[#list pagination.list as companysign ]
			<tr>
				<td align="center">${companysign_index + 1}</td>
				<td align="center">${companysign.companyName!}</td>
				<td align="center">${companysign.promiseAmount!}</td>
				<td align="center">${companysign.totalPrice!}</td>
				<td align="center">${identityMap[companysign.identity?string]!}</td>
				<td align="center">${(companysign.signDate?string("yyyy-MM-dd"))!}</td>
				<td align="center">${(companysign.endDate?string("yyyy-MM-dd"))!}</td>
				<td align="center">
					<button type="button" class="btn btn-danger btn-xs delbtn" onclick="goDetail('${companysign.id}','${companysign.totalPrice!}')">详情</button>
					<button type="button" class="btn btn-danger btn-xs delbtn" onclick="disable('${companysign.id}')">失效</button>
				</td>
			</tr>
			[/#list]
		</table>
		<div class="panel-footer">[@fenye p = pagination form = 'infoForm' /]</div>
	</div>



</body>
</html>
<script type="text/javascript">

	//失效
	function disable(id) {//弹出警告框判断是否删除
		if (confirm('是否确认失效')) {
			$.ajax({
				url : '/company/companysign_disable.do',
				type : 'post',
				dataType : 'json',
				data : {
					id : id
				},
				beforeSend : function() {
					art.dialog.tips("设置中...");
				},
				success : function(data) {
					if (data.success) {
						location.reload();
					} else {
						error_msg(data.msg, function() {
							location.reload();
						});
					}
				}
			});
		}
	}

	//跳转新增页面
	function add() {
		top.addTempTab("/company/companysign_v_add.do");
	}
	//跳转详情页面
	function goDetail(id,totalPrice) {
		top.addTempTab("/company/companysign_detail.do?id="+id+"&totalPrice="+totalPrice);
	}
</script>
